import java.util.regex.Matcher;
import java.util.regex.Pattern;

import mis.ds.ps.controller.Session;
import mis.ds.ps.model.dao.impl.VersoesDaoImpl;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {

		// Session session = new Session("dff");
		// session.setFileToImport("DSD_ACEIS_20102011_V___02_02_2011.xls");
		//
		// MapperLeaf mp = new MapperLeaf("new");
		// mp.setEntity(IEntity.Entities.DISCIPLINAS);
		// mp.setAttribute("nome");
		// mp.setSheet(1);
		// mp.setStartCell(38, 0);
		// mp.setEndCell(145, 0);
		//
		// session.addMapperInUse(mp.getName(), mp);
		// session.simulate();

		// test();

		// test2();

		test3();
	}

	private static void test() {

		Session session = new Session("tt-config.xml");
		VersoesDaoImpl dao = new VersoesDaoImpl();
		dao.setMysqlConn(session.getMysqlConn());
		dao.getVersoes();
	}

	private static void test2() {

		String REGEX = "[a-zA-Z]";
		String INPUT = "dog dog dog doggie dogg";

		Pattern p = Pattern.compile(REGEX);
		Matcher m = p.matcher(INPUT); // get a matcher object
		int count = 0;

		while (m.find()) {
			count++;
			System.out.println("Match number " + count);

			System.out.println("start(): " + m.start());
			System.out.println("end(): " + m.end());
			System.out.println("char(): " + INPUT.substring(m.start(), m.end()));
		}

	}

	private static void test3() {
		String REGEX = "[a-zA-Z]";
		Pattern p = Pattern.compile(REGEX);

		// start cell
		String startCell = "A13";
		Matcher m = p.matcher(startCell); // get a matcher object

		int count = 0;
		while (m.find()) {
			count++;
		}
		String startRow = startCell.substring(0, count);

		if (startRow.length() == 1) {
			System.out.println("LINHA " + ((int) startRow.charAt(0) - 64));
		}
	}
}
